<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Relations\Relation;
use App\Models\Video;
use App\Models\Image;

class MorphServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        $this->addMorphMap();
    }

    protected function addMorphMap(){
//        logger('morphMap===php artisan config:cache==========');
//        Relation::morphMap([
//            Comment::FOR_ARTICLE => Article::class,
//            Comment::FOR_HOUSE_INFO => HouseInfo::class
//        ]);

        Relation::morphMap([
            Image::FOR_VIDEO => Video::class,
        ]);
    }
}
